#ifndef __HR_TM_H

#include "ohos_init.h"
#include "los_task.h"
#include "los_sem.h"
#include "los_swtmr.h"
#include <string.h>
#include <unistd.h>
#include "lcd.h"
#include "e53_me_Fir.h"
#include "e53_medical_electrocardiogram.h"
#include "picture.h"
#include "e53_com.h"
#include "iot.h"
// #include "hal_wdt.h"
// #include "hal_cru.h"


#define TIM_REPORT_STATE_MS         1000                             // 状态报告1000MS
#define TIM_ME_RETRY_SEND_MS        350                              // me 重发 350MS

#define STR_SH_SWTMR_REPORT_STATE   "hrtm_report_state"              // 
#define STR_SH_SWTMR_ME_RETRY_SEND  "hrtm_me_retry_send"             // 


typedef enum
{
    E_KEY_TYPE_NO,
    E_KEY_TYPE_UP,
    E_KEY_TYPE_DOWN,
    E_KEY_TYPE_MAX,
} key_type_e;

typedef enum
{
    E_TASK_TYPE_HRD = 0,
    E_TASK_TYPE_TM,
    E_TASK_TYPE_ME,
    E_TASK_TYPE_MAX,
} task_type_e;


typedef struct
{
    int        state;
    uint32_t   id;
} task_args_t;

typedef enum
{
    THREAD_ID_HR_TM,
    // THREAD_ID_ME,
    // THREAD_ID_HRD,
    THREAD_ID_REV_E53,
    THREAD_ID_WIFI,
    THREAD_ID_REV_NETD,
    THREAD_ID_MAX,
} thread_id_e;

typedef uint32_t athread_id[THREAD_ID_MAX];

typedef struct
{
    uint8_t                       hrd_v;
    uint8_t                       hrd;
    uint8_t                       spo_v;
    uint8_t                       spo;
} hrd_data_t;

typedef struct
{
    uint8_t                       tm_v;
    uint16_t                      tm;
} tm_data_t;

typedef struct
{
    uint8_t                       hrd;
    uint32_t                      frame_num;
    uint32_hrd                    hrd_data;
} me_data_t;




typedef struct
{
    uint8_devnum                  devnum;
    athread_id                    thread_id;
    task_type_e                   task_type;
    Pinctrl                       key;
    swtmr_t                       swtmr;                          //软件定时器
    uint_tick                     switch_task_time;
    
    uint32_t                      report_flag;                    //是否上报状态标志 1上报
    
    hrd_data_t                    hrd;
    tm_data_t                     tm;
    me_data_t                     me;
} hr_tm_t;





#endif